/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package supportlearning.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Huy
 */
@Entity
@Table(name = "StaffProfile", catalog = "SupportLearningDB", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "StaffProfile.findAll", query = "SELECT s FROM StaffProfile s"),
    @NamedQuery(name = "StaffProfile.findByStaffId", query = "SELECT s FROM StaffProfile s WHERE s.staffId = :staffId"),
    @NamedQuery(name = "StaffProfile.findByDescription", query = "SELECT s FROM StaffProfile s WHERE s.description = :description"),
    @NamedQuery(name = "StaffProfile.findBySemesterId", query = "SELECT s FROM StaffProfile s WHERE s.semesterId = :semesterId")})
public class StaffProfile implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "StaffId", nullable = false, length = 50)
    private String staffId;
    @Basic(optional = false)
    @Column(name = "Description", nullable = false, length = 100)
    private String description;
    @Basic(optional = false)
    @Column(name = "SemesterId", nullable = false)
    private int semesterId;
    @JoinColumn(name = "StaffId", referencedColumnName = "AccountId", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.EAGER)
    private Account account;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "staffProfile", fetch = FetchType.EAGER)
    private List<Assignment> assignmentList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "staffProfile", fetch = FetchType.EAGER)
    private List<FeedBack> feedBackList;

    public StaffProfile() {
    }

    public StaffProfile(String staffId) {
        this.staffId = staffId;
    }

    public StaffProfile(String staffId, String description, int semesterId) {
        this.staffId = staffId;
        this.description = description;
        this.semesterId = semesterId;
    }

    public String getStaffId() {
        return staffId;
    }

    public void setStaffId(String staffId) {
        this.staffId = staffId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getSemesterId() {
        return semesterId;
    }

    public void setSemesterId(int semesterId) {
        this.semesterId = semesterId;
    }

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    public List<Assignment> getAssignmentList() {
        return assignmentList;
    }

    public void setAssignmentList(List<Assignment> assignmentList) {
        this.assignmentList = assignmentList;
    }

    public List<FeedBack> getFeedBackList() {
        return feedBackList;
    }

    public void setFeedBackList(List<FeedBack> feedBackList) {
        this.feedBackList = feedBackList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (staffId != null ? staffId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StaffProfile)) {
            return false;
        }
        StaffProfile other = (StaffProfile) object;
        if ((this.staffId == null && other.staffId != null) || (this.staffId != null && !this.staffId.equals(other.staffId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "supportlearning.entity.StaffProfile[staffId=" + staffId + "]";
    }

}
